Crate pinentry[−][src]
Expand description
pinentry
is a library for interacting with the pinentry binaries available on
various platforms.
Examples
Request passphrase or PIN
use pinentry::PassphraseInput;
use secrecy::SecretString;
let passphrase = if let Some(mut input) = PassphraseInput::with_default_binary() {
// pinentry binary is available!
input
.with_description("Enter new passphrase for FooBar")
.with_prompt("Passphrase:")
.with_confirmation("Confirm passphrase:", "Passphrases do not match")
.interact()
} else {
// Fall back to some other passphrase entry method.
Ok(SecretString::new("a better passphrase than this".to_owned()))
}?;
Ask user for confirmation
use pinentry::ConfirmationDialog;
if let Some(mut input) = ConfirmationDialog::with_default_binary() {
input
.with_ok("Definitely!")
.with_not_ok("No thanks")
.with_cancel("Maybe later")
.confirm("Would you like to play a game?")?;
};
Display a message
use pinentry::MessageDialog;
if let Some(mut input) = MessageDialog::with_default_binary() {
input.with_ok("Got it!").show_message("This will be shown with a single button.")?;
};
Structs
A dialog for requesting a confirmation from the user.
An uncommon or unexpected GPG error.
A dialog for showing a message to the user.
A dialog for requesting a passphrase from the user.
Enums
Errors that may be returned while interacting with pinentry
binaries.
Type Definitions
Result type for the pinentry
crate.